package com.wm.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wm.system.domain.Valuation;
import com.wm.system.mapper.ValuationMapper;
import com.wm.system.service.IValuationService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 卖车估值表 服务实现类
 * </p>
 *
 * @author hyq
 * @since 2023-10-10 22:06:26
 */
@Service
public class ValuationServiceImpl extends ServiceImpl<ValuationMapper, Valuation> implements IValuationService {

    @Override
    public List<Valuation> selectValuationList(Valuation valuation) {
        List<Valuation> list = this.lambdaQuery().eq(Valuation::getShopId, valuation.getShopId())
                .list();
        return list;
    }

    @Override
    public void addOrUpdate(Valuation valuation) {
        if(valuation.getId()==null){
            valuation.setCreateTime(LocalDateTime.now());
        }
        this.saveOrUpdate(valuation);
    }
}
